package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zjsd.sqeybusiness.domain.Rechargeinfo;
import com.zjsd.sqeybusiness.service.IRechargeinfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会员充值信息Controller
 *
 * @author Zheng
 * @date 2025-03-10
 */
@RestController
@RequestMapping("/sqeybusiness/rechargeinfo")
public class RechargeinfoController extends BaseController
{
    @Autowired
    private IRechargeinfoService rechargeinfoService;

    /**
     * 查询会员充值信息列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:rechargeinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(Rechargeinfo rechargeinfo)
    {
        startPage();
        List<Rechargeinfo> list = rechargeinfoService.selectRechargeinfoList(rechargeinfo);
        return getDataTable(list);
    }

    /**
     * 导出会员充值信息列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:rechargeinfo:export')")
    //@Log(title = "会员充值信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Rechargeinfo rechargeinfo)
    {
        List<Rechargeinfo> list = rechargeinfoService.selectRechargeinfoList(rechargeinfo);
        ExcelUtil<Rechargeinfo> util = new ExcelUtil<Rechargeinfo>(Rechargeinfo.class);
        return util.exportExcel(list, "rechargeinfo");
    }

    /**
     * 获取会员充值信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:rechargeinfo:query')")
    @GetMapping(value = "/{rechargeid}")
    public AjaxResult getInfo(@PathVariable("rechargeid") Long rechargeid)
    {
        return AjaxResult.success(rechargeinfoService.selectRechargeinfoById(rechargeid));
    }

    /**
     * 新增会员充值信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:rechargeinfo:add')")
    //@Log(title = "会员充值信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Rechargeinfo rechargeinfo)
    {
        return toAjax(rechargeinfoService.insertRechargeinfo(rechargeinfo));
    }

    /**
     * 修改会员充值信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:rechargeinfo:edit')")
    //@Log(title = "会员充值信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Rechargeinfo rechargeinfo)
    {
        return toAjax(rechargeinfoService.updateRechargeinfo(rechargeinfo));
    }

    /**
     * 删除会员充值信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:rechargeinfo:remove')")
    //@Log(title = "会员充值信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{rechargeids}")
    public AjaxResult remove(@PathVariable Long[] rechargeids)
    {
        return toAjax(rechargeinfoService.deleteRechargeinfoByIds(rechargeids));
    }
}
